package com.um.jdy.platform.sharing.manager;

import com.um.jdy.common.sharing.service.RecordsService;
import com.um.jdy.platform.sharing.entity.vo.SharingRecordsOrderVO;
import com.um.jdy.platform.sharing.entity.vo.SharingRecordsSummaryVO;
import com.um.springboot.starter.entity.Page;
import com.um.springboot.starter.orm.entity.Response;
import com.um.springboot.starter.orm.manager.BaseManager;
import com.um.springboot.starter.orm.params.PageParams;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 邓南辉
 * 日期 2023/5/11
 * 版权所有 广州优匠科技有限公司
 */
@Service
@Slf4j
public class SharingRecordsManager extends BaseManager<RecordsService> {

    /**
     * 查询分佣订单
     *
     * @return
     */
    public Response getSharingRecordsPage(PageParams params) {
        Page page = new Page();
        page.setPageNo(params.getPageNo());
        page.setPageSize(params.getPageSize());

        params.getCondition().put("o.com_id",getComId());

        page = service.getCMSViewModelPageBySqlName(page, "get_profit_sharing_order_records_page","get_profit_sharing_order_records_count",SharingRecordsOrderVO.class,params.getProperties(), params.getValues(),params.getRangeEntitys(),params.getOrderNames(),params.getSortOns());
        SharingRecordsSummaryVO summaryVO = service.getCMSViewModelBySqlName("get_profit_sharing_order_records_summary",SharingRecordsSummaryVO.class,params.getProperties(), params.getValues(),params.getRangeEntitys());
        page.setExtraData(summaryVO);
        return Response.success(page);
    }
}
